/**
 * Created by xiaom on 2016/10/29.
 */
import React, {Component, PropTypes} from 'react';
import {Link} from 'react-router';
import './index.scss';

export default class Item extends Component {

  static defaultProps = {
    to: '',
    href: ''
  };

  static propTypes = {
    to: PropTypes.string,
    href: PropTypes.string,
    title: PropTypes.string,
    icon: PropTypes.string
  };

  render() {
    const _this = this;
    if (_this.props.to !== '') {
      return (
        <div>
          <div className="item fun-wh fun">
            <Link to={_this.props.to}>
              <div className="info">
                <i className={_this.props.icon}></i>
                <div className="title">{_this.props.title}</div>
              </div>
            </Link>
          </div>
        </div>
      );
    } else if (_this.props.href !== '') {
      return (
        <div className="item fun-wh fun">
          <a href={_this.props.href}>
            <div className="info">
              <i className={_this.props.icon}></i>
              <div className="title">{_this.props.title}</div>
            </div>
          </a>
        </div>
      );
    }
    return (
      <div>
        <div className="fun-wh"></div>
      </div>
    );
  }
}
